<?php 
require_once('AuthenticationHandler.class.php');
class SQLAuthenticationHandler extends  AuthenticationHandler 
{
    
        /**
     * A database connection.
     *
     * @access protected
     * @since  2.0
     * @type   resource
     */
    var $conn;


    /**
     * Create a new SQLAuthenticationHandler instance.
     *
     * @access public
     * @since  2.0
     */
    function SQLAuthenticationHandler($params)
    {

        $this->conn       =  NULL;

        // set default parameters
        $defparams             = array();
        $defparams['table']    = 'user_tables';
        $defparams['username_col'] = 'username';
        $defparams['password_col']   = 'password';

        // merge parameters
        $params = array_merge($defparams, $params);
    }

    function login (&$controller,&$user){
        $error = 'SQLAuthenticationHandler::login(&$controller,&$user) must be overridden';

        trigger_error($error, E_USER_ERROR);

        exit;        
    }
    
    function logout (&$controller,&$user){
        $error = 'SQLAuthenticationHandler::logout(&$controller,&$user) must be overridden';

        trigger_error($error, E_USER_ERROR);

        exit;        
        
    }
    
 /**
     * Retrieve the database connection.
     *
     * @return resource A database connection.
     *
     * @access public
     * @since  2.0
     */
    function & getConnection ()
    {

        return $this->conn;

    }

    /**
     * Retrieve the number of rows from a result set.
     *
     * @param resource A result set.
     *
     * @return int The number of rows in a result set.
     *
     * @access public
     * @since  2.0
     */
    function getNumRows (&$result)
    {

        $error = 'SQLAuthenticationHandler::getNumRows(&$result) must be overridden';

        trigger_error($error, E_USER_ERROR);

        exit;

    }

    /**
     * Set the database connection.
     *
     * @param resource A database connection.
     *
     * @access public
     * @since  2.0
     */
    function setConnection (&$conn)
    {

        $this->conn =& $conn;

    }
    

}

?>